﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<t_205_verk_hopur_12.Models.EditScheduleViewModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Breyta dagskrá
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <h2>
        Dagskráin <%= Html.Encode(Model.ThisDay.Day)%>.<%= Html.Encode(Model.ThisDay.Month)%>, <%= Html.Encode(Model.ThisDay.Year)%>
    </h2>
     <%= Html.ActionLink("Skrá nýtt myndband", "AddVideo", new { id = Model.CurrentChannel.ID })%>
     <p>&nbsp;</p>
    <div>
        <a href="/Channel/EditSchedule/<%= Model.CurrentChannel.ID%>/<%= Model.PreviousDay.Year%>-<%= Model.PreviousDay.Month%>-<%= Model.PreviousDay.Day%>">Dagurinn á undan</a> / 
        <a href="/Channel/EditSchedule/<%= Model.CurrentChannel.ID%>/<%= Model.NextDay.Year%>-<%= Model.NextDay.Month%>-<%= Model.NextDay.Day%>">Dagurinn á eftir</a>
    </div>
    
<div id="ScheduleLeft">
    <table class="NeatTable">
        <tr>
            <th></th>
            <th>
                Titill
            </th>
            <th>
                Byrjar
            </th>
            <th>
                Endar
            </th>
        </tr>

    <% foreach (var item in Model.DayOfVideos)
       { %>
    
        <tr>
            <td>
                <%= Html.ActionLink("Nánar", "VideoDetails", new { id=item.ChannelID, videoID = item.VideoID })%> |
                <%= Html.ActionLink("Eyða", "DeleteSchedule", new { id = item.ChannelID, scheduleID = item.ID, day = item.StartTime.ToString("yyyy-MM-dd") }, null)%>
            </td>
            <td>
                <%= Html.ActionLink(item.Title, "Index", "Channel", new { id = item.ChannelID, videoID = item.ID }, null)%>
            </td>
            <td>
                <%= Html.Encode(String.Format("{0:00}", item.StartTime.Hour))%>:<%= Html.Encode(String.Format("{0:00}", item.StartTime.Minute)) %>
            </td>
            <td>
                <%= Html.Encode(String.Format("{0:00}", item.EndTime.Hour))%>:<%= Html.Encode(String.Format("{0:00}", item.EndTime.Minute))%>
            </td>
            <td>
                <%= Html.ActionLink("Breyta", "EditSchedule", new { channelID = item.ChannelID, day=String.Format(item.StartTime.ToString("yyyy-MM-dd")), scheduleID = item.ID }) %>
            </td>
        </tr>
    
    <% } %>

    </table>
</div>
<div id="ScheduleRight">
    <% if (Model.Videos != null) { %>
    <% using (Html.BeginForm()) {%>
        <table class="NeatTable">
            <tr>
                <td><b>Titill:</b></td>
                <td><%= Html.DropDownList("ScheduleVideo", (SelectList)ViewData["SelectList"])%></td>
            </tr>
            <tr>
                <td><b>Frá:</b></td>
                <td>
                    <select name="fromHour">
                    <% for(int i = 0; i < 24; i++){ %>
                        <option value="<%= String.Format("{0:00}", i)%>" <%= (Model.Schedule != null && Model.Schedule.StartTime.Hour == i ? "selected" : "") %>>
                            <%= String.Format("{0:00}", i)%>
                        </option>
                    <% } %>
                    </select>
                    <select name="fromMinute">
                    <% for(int i = 0; i < 60; i++){ %>
                        <option value="<%= String.Format("{0:00}", i)%>" <%= (Model.Schedule != null && Model.Schedule.StartTime.Minute == i ? "selected" : "") %>>
                            <%= String.Format("{0:00}", i)%>
                        </option>
                    <% } %>
                    </select>
                </td>
             </tr>
             <tr>
                <td><b>Til:</b></td>
                <td>
                    <select name="toHour">
                    <% for(int i = 0; i < 24; i++){ %>
                        <option value="<%= String.Format("{0:00}", i)%>" <%= (Model.Schedule != null && Model.Schedule.EndTime.Hour == i ? "selected" : "") %>>
                            <%= String.Format("{0:00}", i)%>
                        </option>
                    <% } %>
                    </select>
                    <select name="toMinute">
                    <% for(int i = 0; i < 60; i++){ %>
                        <option value="<%= String.Format("{0:00}", i)%>" <%= (Model.Schedule != null && Model.Schedule.EndTime.Minute == i ? "selected" : "") %>>
                            <%= String.Format("{0:00}", i)%>
                        </option>
                    <% } %>
                    </select>
                </td>
            </tr>
            <tr>
                <td></td>
                <td><input type="submit" name="submit" value="<%= (Model.Schedule != null ? "Breyta" : "Skrá") %>" /></td>
            </tr>
          </table>
        <% } %>
    <% } %>
</div>
<div class="clear"></div>
    <%= Html.ActionLink("Til baka", "Schedule", new { id = Model.CurrentChannel.ID })%>

</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="LogoText" runat="server">
    <%= Html.ActionLink(Model.CurrentChannel.Name, "Index", new { id = Model.CurrentChannel.ID }) %>
</asp:Content>

<asp:Content ID="Content4" ContentPlaceHolderID="MenuBar" runat="server">
    <% Html.RenderPartial("AdminChannelMenuBar", Model.CurrentChannel); %>
</asp:Content>

